package com.tuanbiao.models.action;

import com.hzjq.data.callback.Callback;
import com.hzjq.data.hzjq.entity.LogEntity;
import com.hzjq.data.room.db.LogDB;
import com.hzjq.lib.BlastKool;
import com.tuanbiao.data.callback.OnBaseResultCallback;

import java.util.List;

/**
 * @author abiao
 * @since 2022/4/25 14:10
 */
public interface LogAction {
    default void getLogs(OnBaseResultCallback<List<LogEntity>> callback) {
        BlastKool.Companion.loader().db().queryUnBlastLog(new Callback<List<LogEntity>>() {
            @Override
            public void run(List<LogEntity> logEntities) {
                callback.onSuccess(logEntities);
                callback.onFinish();
            }
        });
    }

    default List<LogEntity> getLogs(String blastId) {
        return LogDB.Companion.query(blastId);
    }

    default void insertLog(LogEntity entity) {
        LogDB.Companion.insert(entity);
    }

    default void deleteLog(String blastId) {
        LogDB.Companion.delete(blastId);
    }


}
